package com.program.cloudmanage.tripteam.persistence;

import com.program.cloudmanage.tripteam.domain.Car;
import com.program.cloudmanage.tripteam.domain.Itinerary;
import com.program.cloudmanage.tripteam.domain.Person;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ItineraryMapper {
    @Select("select * from itinerary")
    List<Itinerary> showItinerary();

    @Select("select * from itinerary where itinerary.teamid = #{teamid}")
    List<Itinerary> searchItineraryByTeamId(String teamid);

    @Select("select * from itinerary where itinerary.personid = #{personid}")
    Itinerary searchItineraryByPersonId(String personid);

    @Select("select * from itinerary where itinerary.itineraryid = #{itineraryid}")
    Itinerary searchItinerary(String itineraryid);

    @Insert("insert into itinerary(itineraryid,teamid,personid,startpoint,terminal,similarity,pass,wayposition) values (#{itineraryid},#{teamid},#{personid},#{startposition},#{terminal},#{similarity},#{pass},#{wayposition})")
    void insertItinerary(@Param("itineraryid")String itineraryid,@Param("teamid")String teamid,@Param("personid")String personid,@Param("startposition")String startposition,@Param("terminal")String terminal,@Param("similarity") String similarity,@Param("pass") String pass,@Param("wayposition") String wayposition);

    @Delete("delete from itinerary where itineraryid = #{itineraryid}")
    void deleteItinerary(String itineraryid);

    @Update("update itinerary set similarity=#{similarity} where itineraryid=#{itineraryid}")
    void updateSimilarity(@Param("similarity") String similarity,@Param("itineraryid") String itineraryid);
    @Update("update itinerary set pass=#{pass} where itineraryid=#{itineraryid}")
    void updateItinerary(@Param("itineraryid") String itineraryid,@Param("pass")String pass);

}
